<%@ page import="com.fduss.artStore.entity.Customer" %>
<%@ page import="com.fduss.artStore.entity.CustomerLogon" %><%--
  Created by IntelliJ IDEA.
  User: duocai wu
  Date: 2017/6/29
  Time: 14:28
--%>

<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">
                <img alt="Brand" height="30" src="./art-images/logo.PNG">
            </a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li><a href="./">Artworks</a></li>
                <li><a href="./artist.jsp">Artists</a></li>

                <% if (session.getAttribute("user") == null) {%>
                    <li><a href="./loginPage.jsp">Sign in</a></li>
                    <li><a href="./registerPage.jsp">Sign up</a></li>
                <% }else {
                    CustomerLogon customerTmp = ((Customer)session.getAttribute("user")).getCustomerLogon();
                %>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                           aria-haspopup="true" aria-expanded="false">
                            <%=customerTmp.getUserName()%><span class="caret"></span>
                        </a>
                        </a>
                        <ul class="dropdown-menu">
                            <li class="dropdown-header">Basic</li>
                            <li><a href="./profile.jsp#Profile">Your Profile</a></li>
                            <li><a href="./profile.jsp#Cart">Your Cart</a></li>
                            <li><a href="./profile.jsp#Records">Your Records</a></li>
                            <li role="separator" class="divider"></li>
                            <li class="dropdown-header">Others</li>
                            <li><a href="./profile.jsp#Settings">Settings</a></li>
                            <li><a href="./signOut">Sign out</a></li>
                        </ul>
                    </li>
                <% }%>
            </ul>
            <%--搜索--%>
            <form action="./searchList.jsp" class="navbar-form navbar-right">
                <div class="form-group">
                    <input type="text"
                           value="<%=request.getParameter("search_key")!=null ? request.getParameter("search_key"):""%>"
                           name="search_key" class="form-control" placeholder="Search Art Store">
                </div>
                <button type="submit" class="btn btn-success">Search</button>
            </form>
        </div>
    </div>
</nav>


